package outils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

/**
 * 
 */

/**
 * @author alith
 *
 */
@SuppressWarnings("serial")
public class Ligne extends ArrayList<String> {
	
	private static String comment = "#comment";
	
	public Ligne(Collection<String> ligne) {
		this.addAll(ligne);
	}
	
	public Ligne(String ligne) {
		this.addAll(Arrays.asList(ligne.trim().split(" ")));
	}
	
	//ca sert a rien mais c'est joli...
	public boolean isComment(){
		return (size()>0) && (get(0).equalsIgnoreCase(comment));
	}
	
	public String toString() {
		String result = "";
		for (String s : this) {
			result += s + " ";
		}
		return result;
	}
	
	public boolean equals (Ligne other) {
		boolean result = true;
		for (int i = 0; i<this.size(); i++) {
			if (!this.get(i).equalsIgnoreCase(other.get(i))) result = false;
		}
		return result;
	}
}
